package com.ringtheweb.model;

import static javax.persistence.GenerationType.*;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import org.hibernate.annotations.CascadeType;


@Entity
public class PlayList implements Serializable {
	
	private static final long serialVersionUID = 200L;

	@Id
	@GeneratedValue(strategy=AUTO)
	@Column(name="PLAYLIST_ID")
	private Long id;
	
	@OneToOne
	@JoinColumn(name="PHONE_ID")
	private PhoneNumber phoneNumber;

	@OneToMany
	@JoinColumn(name="PLAYLIST_ID")
	@org.hibernate.annotations.Cascade(
			value = {CascadeType.ALL,CascadeType.DELETE_ORPHAN}
	)
	@org.hibernate.annotations.IndexColumn(name = "PLAY_POSITION")
	private List<Play> plays = new ArrayList<Play>();
	

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public List<Play> getPlays() {
		return plays;
	}

	public void setPlays(List<Play> plays) {
		this.plays = plays;
	}

	public PhoneNumber getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(PhoneNumber phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

}
